<?php
$isReloadable = true;
require_once("../../pers/inc.config.php");
require_once(R2_FS_WEB_ROOT.'/app/_inc/inc.session.php');
require_once(R2_FS_WEB_ROOT.'/app/_inc/funct.html.php');

//Gestione azioni
if (reqvar('azione')!=''){
	reqDef('sospeso','N');
}
if (reqvar('azione')=='salva'){
	$msgPag .= salva();
}
reqDef('denominaz','');
reqDef('sospeso','N');

$sCmdL = "";
$sCmdR = "";

if ($objSess->abilitaz['gescomm'] == 'W') {
	$sCmdR .= "<a class='cmd1' href='javascript:document.frm1.submit();' >salva</a>";
}	
$sCmdR .= cmdTorna('torna');

$aMenuPag = array();
include("_inc/inc.aMenuPag.php");
testaHtml('Inserisci Cliente', $msgPag, '30.10.10', $aMenuPag);
echo getHtmlForm();
echo getHtmlHidden('xsn');
echo getHtmlHidden('azione','salva');
?>
<table border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="cmd1" align="left" valign='top'><?=$sCmdL?></td>
      <td class="cmd1" align="right"><?=$sCmdR?></td>
   </tr>
</table>
<table class="tab1" border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
<?php echo getHtmlRigaRif();?>
	<tr>
		<td class="tit1" colspan='20' align='center'>Cliente</td>
	</tr>
    <tr>
   	<td class="lab1" colspan='4'>Denominazione</td>
	  	<td class="txt1" colspan='13'><?echo getHtmlText('denominaz',60);?></td>
   	<td class="lab1" colspan='2'>Sospeso</td>
	  	<td class="txt1" colspan='1'><?echo getHtmlCheckBox('sospeso', 'S');?></td>
    </tr>
</table>
<table border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="cmd1" align="left" valign='top'><?=$sCmdL?></td>
      <td class="cmd1" align="right"><?=$sCmdR?></td>
   </tr>
</table>
<?
codaHtml();
exit();

function salva() {
	global $objDB, $objSess;

	$msg = '';
	if ($msg != '') {return $msg;}
	
	$sSql = "INSERT INTO cliente SET denominaz = '".reqvarAS('denominaz')."' "
		.", sospeso = '".reqvarAS('sospeso')."' ";
	$objDB->query($sSql);
	header("Location: ".urlTorna());
	exit();
}

?>